package client.comm.baoding.adapter;

import android.graphics.Color;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import client.comm.baoding.R;

public class BankTypeAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private int currentIndex = -1;

    public BankTypeAdapter(@Nullable List<String> data) {
        super(R.layout.item_single_text, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, String bean) {
        baseViewHolder.setText(R.id.tv_text, bean);
        TextView tvText = baseViewHolder.getView(R.id.tv_text);
        if (currentIndex >= 0 && currentIndex == baseViewHolder.getAdapterPosition()) {
            tvText.setTextColor(Color.parseColor("#18A5FF"));
            tvText.getPaint().setFakeBoldText(true);
            tvText.setTextSize(15);
        } else {
            tvText.setTextColor(Color.parseColor("#666666"));
            tvText.getPaint().setFakeBoldText(false);
            tvText.setTextSize(14);
        }
    }

    public int getCurrentIndex() {
        return currentIndex;
    }

    public void setCurrentIndex(int currentIndex) {
        this.currentIndex = currentIndex;
        notifyDataSetChanged();
    }
}
